import request from '@/utils/request'

// 创建生产计划
export function createPlan(data) {
  return request({
    url: '/production/plan/create',
    method: 'post',
    data: data
  })
}

// 更新生产计划
export function updatePlan(data) {
  return request({
    url: '/production/plan/update',
    method: 'put',
    data: data
  })
}

// 删除生产计划
export function deletePlan(id) {
  return request({
    url: '/production/plan/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除生产计划 */
export function deletePlanList(ids) {
  return request({
    url: `/production/plan/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得生产计划
export function getPlan(id) {
  return request({
    url: '/production/plan/get?id=' + id,
    method: 'get'
  })
}

// 获得生产计划分页
export function getPlanPage(params) {
  return request({
    url: '/production/plan/page',
    method: 'get',
    params
  })
}
// 导出生产计划 Excel
export function exportPlanExcel(params) {
  return request({
    url: '/production/plan/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}